#pragma once
#include "enums.h"
#include <memory>
#include "Helper.h"
#include "primitives.h"

namespace DXBase
{
	namespace DWrite
	{
		ref class TextFormat;
		ref class Typography;

		// Takes a string, text format, and associated constraints, and produces 
		// an object that represents the fully analyzed and formatted result
		[Windows::Foundation::Metadata::WebHostHidden]
		public ref class TextLayout sealed
		{
		internal:
			Microsoft::WRL::ComPtr<IDWriteTextLayout> mTextLayout;

		public:
			TextLayout(Platform::String^ string, TextFormat^ format, float maxWidth, float maxHeight);

			void SetFontSize(float value, Range range);
			bool TryGetFontSize(uint32 pos, float* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetFontSize(uint32 pos, float* value) { return TryGetFontSize(pos, value, nullptr); }

			void SetTypography(Typography^ value, Range range);
			bool TryGetTypography(uint32 pos, Typography^* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetTypography(uint32 pos, Typography^* value) { return TryGetTypography(pos, value, nullptr); }

			void SetFontWeight(FONT_WEIGHT value, Range range);
			bool TryGetFontWeight(uint32 pos, FONT_WEIGHT* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetFontWeight(uint32 pos, FONT_WEIGHT* value) { return TryGetFontWeight(pos, value, nullptr); }

			void SetFontStyle(FONT_STYLE value, Range range);
			bool TryGetFontStyle(uint32 pos, FONT_STYLE* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetFontStyle(uint32 pos, FONT_STYLE* value) { return TryGetFontStyle(pos, value, nullptr); }

			void SetFontStretch(FONT_STRETCH value, Range range);
			bool TryGetFontStretch(uint32 pos, FONT_STRETCH* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetFontStretch(uint32 pos, FONT_STRETCH* value) { return TryGetFontStretch(pos, value, nullptr); }

			void SetUnderline(bool value, Range range);
			bool TryGetUnderline(uint32 pos, bool* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetUnderline(uint32 pos, bool* value) { return TryGetUnderline(pos, value, nullptr); }

			void SetStrikethrough(bool value, Range range);
			bool TryGetStrikethrough(uint32 pos, bool* value, Range* range);
			[Windows::Foundation::Metadata::DefaultOverload]
			bool TryGetStrikethrough(uint32 pos, bool* value) { return TryGetStrikethrough(pos, value, nullptr); }

			// TODO: other get/set methods DrawingEffect, FontCollection, FontFamilyName, InlineObject, LocaleName, MaxHeight, MaxWiddth, 
			// TODO: other methods ClusterMetrics, LineMetric, Metrics, OverhangMetrics, 
			// TODO: other methods HitTestXXX
		};
	}
}